﻿using ZilLion.Service.Core.DapperWrapper;
using ZilLion.Service.Core.DapperWrapper.SqlServer;
using ZilLion.Service.WeChatMall.Domain.Entitys.ShopInfo;
using ZilLion.Service.WeChatMall.Domain.Repositorys.Interface.ShopInfo;

namespace ZilLion.Service.WeChatMall.Domain.Repositorys.ShopInfo
{
    public class OfflineShopRelationshipReponsitory : SqlServerRespository<OfflineShopRelationshipEntity>,
        IOfflineShopRelationshipReponsitory
    {
        public OfflineShopRelationshipReponsitory()
        {
            Context = new WechatMallContext();
        }
        public void AddRelationship(OfflineShopRelationshipEntity entity, UnitOfWork unit)
        {
            Add(entity, unit);
        }

        public void DeleteRelationshipByOfflineShop(int shopid,string zlcompanykey, UnitOfWork unit)
        {
            DapperHelper.Execute(@"delete from offlineshoprelationship where offlineshopid=@shopid and zlcompanykey=@zlcompanykey", Context, unit, new { shopid, zlcompanykey });
        }

        public void DeleteRelationshipByOnlineShop(long shopid, UnitOfWork unit)
        {
            DapperHelper.Execute(@"delete from offlineshoprelationship where shopid=@shopid and zlcompanykey=@zlcompanykey", Context, unit, new { shopid });
        }

      
    }
}